//
//  GXChangeGroupNameController.m
//  YIChuSeller
//
//  Created by 田小椿 on 2018/12/14.
//  Copyright © 2018年 xiangshengjun. All rights reserved.
//

#import "GXChangeGroupNameController.h"

@interface GXChangeGroupNameController ()
@property (weak, nonatomic) IBOutlet UITextField *nameTF;

@end

@implementation GXChangeGroupNameController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"更改分组名";
    self.view.backgroundColor = kGlobalbgColor;
    self.nameTF.placeholder = self.groupModel.name;
}

- (IBAction)pressSaveBtn:(id)sender {
    if ([NSString isBlankString:self.nameTF.text]) {
        [SVProgressHUD showErrorWithStatus:@"输入为空"];
        return;
    }
    GXMenuGroupModel *model = self.groupModel;
    model.name = self.nameTF.text;
    [MenuContentManager changeMenuGroupNameWithSdishesId:self.groupModel.dishesId groupName:self.nameTF.text success:^(id responseObject) {
        if (responseObject) {
            [self handleChangeSuccessOperation:model];
        }
    } fail:^(id responseObject) {
        
    }];
}
- (void)handleChangeSuccessOperation:(GXMenuGroupModel *)model
{
    if (self.refreshBlock) {
        self.refreshBlock(model);
    }
}



@end
